package com.damacheng009.future.alarm.toolkit;

import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

public class MiscTool {

	public static ZonedDateTime changeShanghaiToUTC(String beijingDateTimeStr) {
		DateTimeFormatter beijingFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
				.withZone(ZoneId.of("Asia/Shanghai"));

		ZonedDateTime beijingDateTime = ZonedDateTime.parse(beijingDateTimeStr, beijingFormatter);
		return beijingDateTime.withZoneSameInstant(ZoneId.of("UTC"));
	}
	
}
